<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //   将用户输入的网址全部转化成我们的官网。如www.baidu.com=>www.lagou.com
        while (true) {
            const a = prompt("请输入网址")

            const reg = /^(w{3})(\.{1}).+\2(com)$/
            alert(a.replace(reg, function (match, $1, $2, $3) {
                return $1 + $2 + `lagou` + $2 + $3;
            }))

        }

    </script>

</body>

</html>